from flask import Blueprint,current_app,make_response
from flask_wtf import csrf

web_html=Blueprint("web_html",__name__)

@web_html.route("/<re(r'.*'):filename>")
def get_html(filename):
    
    if filename:
        if filename!='favicon.ico':
            filename='html/'+filename
    else :
        filename='html/'+'index.html'
    csrf_token=csrf.generate_csrf()
    rsp=make_response(current_app.send_static_file(filename))

    rsp.set_cookie('csrf_token',csrf_token)
    print(filename)
    return rsp
    
